package Buscaminas.Dialogos;

import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.border.LineBorder;


@SuppressWarnings("serial")
public class DialogoChivato extends JDialog implements ActionListener{

	/**
	 * Variables de instancia
	 */
	private int alto, ancho;// alto, ancho
	private boolean [][]bombas;// Posiciones de las bombas
	private JLabel [][]lCasillas;// Matriz de Casillas
	
	/**
	 * Constructor
	 */
	public DialogoChivato(boolean [][]b, Icon iBomba){

		alto = b.length;
		ancho = b[0].length;
		bombas = b;
		
		this.setTitle("Chivato");
		this.setLayout(new GridLayout(alto,ancho));
		lCasillas = new JLabel [alto][ancho];
		
		for(int i=0; i<alto ;i++)
			for(int k=0; k<ancho; k++){
			
				if(bombas[i][k]){// Si hay bomba
					lCasillas[i][k] = new JLabel(iBomba);
//					lCasillas[i][k].setBackground(Color.ORANGE);
					this.add(lCasillas[i][k]);
				}
				else{// Si no hay bomba
					lCasillas[i][k] = new JLabel();
					lCasillas[i][k].setBackground(Color.ORANGE);
					this.add(lCasillas[i][k]);
				}
				lCasillas[i][k].setBorder(new LineBorder(Color.BLACK)); 
			}
				
				
		
		
		// Control de cierre, pack, setVisible,...
//		this.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
//		this.setPreferredSize(new Dimension(277,220));
		this.pack();
		this.setVisible(true);
		this.setResizable(false);
	}
	
	
	/**
	 * ActionListener
	 */
	public void actionPerformed(ActionEvent arg0) {
		
	}
	 /**
	  * Get
	  */

}
